import React, { Component } from 'react';
import { Grid, Card, Moment } from '@icedesign/base';
// import IceContainer from '@icedesign/container';
import { GetUrlParam, LoginReq } from '../../../../baseConfig';
import NewList from '../../../../components/NewsList'
// import axios from 'axios';
import { Link } from 'react-router-dom';
import './ReviewDetailInfo.scss';

const { Row, Col } = Grid;

export default class ReviewDetailInfo extends Component {
  static displayName = 'ReviewDetailInfo';

  constructor(props) {
    super(props);
    // console.log("ReviewDetailInfo",this.props.machineCode)
    this.state = {
      url:'',
      leftURL,
      centerURL,
      rightURL,
      newsid:'',
    };
  }

  componentWillMount(){
    
  }

  componentDidMount(){
    console.log(this.GetUrlParam("secu_code"))
    this.setState({
      // url:GetUrlParam("secu_code")
      leftURL:`https://goldeye.cfbond.com/cattle/opinion_list?secu_code=${this.sGetUrlParam("secu_code")}&origin=3,4,5,6,7,8,9,10,11,12`,
      centerURL:`https://goldeye.cfbond.com/cattle/opinion_list?api_type=special&secu_code=${this.sGetUrlParam("secu_code")}&origin=1&options=2`,
      rightURL:`https://goldeye.cfbond.com/cattle/opinion_list?api_type=special&secu_code=${this.sGetUrlParam("secu_code")}&options=1&origin=2`,
    })
  }

  sGetUrlParam(paraName)  {
    　var url = document.location.toString();
        console.log("url",url)
    　var arrObj = url.split("?");
    　　　if (arrObj.length > 1) {
    　　　　　var arrPara = arrObj[1].split("&");
    　　　　　var arr;
    　　　　　for (var i = 0; i < arrPara.length; i++) {
    　　　　　　　arr = arrPara[i].split("=");
    　　　　　　　if (arr != null && arr[0] == paraName) {
    　　　　　　　　　return arr[1];
    　　　　　　　}
    　　　　　}
    　　　　　return "";
    　　　}
    　　　else { return ""; }
    }

  render() {
    return (
      <Row wrap gutter="20">
        <Col s="8" xxs="24">
          <Card
              title="热点信息"
              style={styles.container}
              extra={
                <Link 
                  to={`/Evaluate`}
                  search={`?secu_code=${this.props.machineCode}&timeIndexSelcet=24小时&origin=3,4,5,6,7,8,9,10,11,12&comblineflg=1`}
                  replace
                >更多</Link>
              }
              bodyHeight="auto">
              <NewList dataURL={this.state.leftURL} />
          </Card>
        </Col>
        <Col s="8" xxs="24">
          <Card
            title="敏感信息"
            style={styles.container}
            extra={
            <Link to={`/Evaluate?secu_code=${this.props.machineCode}&timeIndexSelcet=24小时&options=2&comblineflg=1&origin=1`}>更多</Link>
            }
            bodyHeight="auto">
            <NewList dataURL={this.state.centerURL} />
          </Card>
        </Col>
        <Col s="8" xxs="24">
          <Card title="热点微博" style={styles.container} extra={<Link to={`/Evaluate?secu_code=${this.props.machineCode}&timeIndexSelcet=24小时&&orderBy=3&options=1&comblineflg=1&origin=2`}>更多</Link>} bodyHeight="auto">
            <NewList dataURL={this.state.rightURL} />
          </Card>
        </Col>
      </Row>
    );
  }
}

const styles = {
  container: {
    // height: 316,
    width:'100%',
    borderRadius:'0',
    boxShadow:'none',
  },
  card:{

  },
  reviewRatingWrapper: {
    padding: '20px 0',
  },
  reviewRatingDesc: {
    color: '#999',
    textAlign: 'center',
  },
  reviewRating: {
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'center',
  },
  reviewRatingScore: {
    fontSize: 36,
    position: 'absolute',
    right: 'calc(100% + 20px)',
  },
  reviewRatingIcon: {
    position: 'relative',
    margin: '0 20px',
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'center',
  },
  reviewRatingRatePositive: {
    fontSize: 26,
    color: '#2ecc71',
    position: 'absolute',
    left: 'calc(100% + 20px)',
  },
  reviewRatingRateNegative: {
    fontSize: 26,
    color: '#e74c3c',
    position: 'absolute',
    left: 'calc(100% + 20px)',
  },
  reviewRatingIconPositive: {
    color: '#2ecc71',
  },
  reviewRatingIconNegative: {
    color: '#e74c3c',
  },
  reviewRatingDivideLine: {
    borderTop: '1px solid #eee',
    width: 100,
    margin: '0 auto',
  },
  reviewTargetProgressWrapper: {
    padding: '30px 0 20px 0',
    display: 'flex',
    justifyContent: 'center',
  },
  reviewRatingGoalDesc: {
    textAlign: 'center',
  },
  reviewLeaderboardItem: {
    marginTop: 10,
    display: 'flex',
    alignItems: 'center',
    position: 'relative',
    justifyContent: 'space-between',
  },
  reviewLeaderboardItemAvatar: {
    borderRadius: '50%',
    overflow: 'hidden',
    display: 'inline-block',
    marginRight: 15,
  },
  reviewLeaderboardItemAvatarImg: {
    display: 'block',
  },
  reviewLeaderboardItemName: {
    flex: 1,
  },
};
